Such an electric compressor is disclosed, for example, in Patent Document 1. In the electric compressor disclosed in Patent Document 1, an electric motor and a compression mechanism are housed in a casing. The electric motor includes a rotor that has a plurality of magnetic poles, and an annular stator that is disposed radially outside the rotor and that has a plurality of slots. The compression mechanism is driven by the electric motor. A plurality of recesses are formed in the outer periphery of the stator so as to be spaced apart from each other in the circumferential direction, and the stator is fixed to the casing by shrink fitting at a plurality of portions other than the recesses.